using System.Collections.Generic;
using UnityEngine;

namespace Voodoo.Meta
{
	[CreateAssetMenu(menuName = "Voodoo/Leaderboard/LeaderboardMedalData", fileName = "LeaderboardMedalData")]
	public class LeaderboardMedalData : ScriptableObject
	{
		[Tooltip("Gives a medal based on rank: ]min,max]")]
		[SerializeField]
		private List<Vector2Int> _ranges = new List<Vector2Int>();

		[Tooltip("The medal sprites to use")]
		[SerializeField]
		private Sprite _medalSprite;

		public Sprite MedalSprite => _medalSprite;

		public bool IsInRange(int rank)
		{
			for (int i = 0; i < _ranges.Count; i++)
			{
				Vector2Int vector2Int = _ranges[i];
				if (rank > vector2Int.x && rank <= vector2Int.y)
				{
					return true;
				}
			}
			return false;
		}
	}
}
